const MyPromise = require("./my-promise");

const p1 = new MyPromise((resolve, reject) =>
  setTimeout(() => {
    reject("A");
  }, 1000)
);
const p2 = new MyPromise((resolve, reject) =>
  setTimeout(() => {
    reject("B");
  }, 2000)
);
const p3 = new MyPromise((resolve, reject) =>
  setTimeout(() => {
    reject("C");
  }, 3000)
);
const p4 = new MyPromise((resolve, reject) =>
  setTimeout(() => {
    reject("D");
    // resolve('D');
  }, 1500)
);

MyPromise.any([p1, p2, p3, p4])
  .then((re) => console.log("res: ", re))
  .catch((err) => console.log("e: ", err));
